<template>
  <div class="common_layer" v-if="recommend">
    <div class="warp">
      <h2 class="title"><slot></slot></h2>
      <ul>
        <router-link
          tag="li"
          :to="{
            name: 'comment',
            query: { id: recommend.id, title: recommend.title },
          }"
          v-for="recommend in recommend"
          :key="recommend.id"
        >
          <div class="left">
            <div class="img">
              <img :src="recommend.cover" alt="" />
            </div>
          </div>
          <div class="right">
            <p class="book">
              <i class="name">{{ recommend.title }}</i>
            </p>
            <p class="type">
              <span>{{ recommend.author }}</span
              ><i>{{ recommend.category }}</i>
            </p>
            <p class="description">
              {{ recommend.content }}
            </p>
          </div>
        </router-link>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  props: ["recommend"],
};
</script>
<style lang="less" scoped>
.common_layer {
  padding: 13px;
  .warp {
    border-bottom: 1px solid #eeeeee;
    .title {
      font-size: 18px;
      color: #232323;
      font-weight: 600;
    }

    ul {
      margin-top: 20px;
      li {
        display: flex;
        // justify-content: space-between;
        padding-bottom: 15px;
        .left {
          .img {
            width: 80px;
            height: 105px;
            box-shadow: 3px 2px 8px -3px #706e6b;
            img {
              width: 80px;
              height: 105px;
            }
          }
        }
        .right {
          flex: 1;
          margin-left: 13px;
          line-height: 20px;
          .book {
            display: flex;
            i {
              font-style: normal;
              font-size: 16px;
              font-weight: 600;
              color: #383838;
            }
          }
          .description {
            font-size: 12px;
            color: #7a7a7a;
            text-overflow: -o-ellipsis-lastline;
            overflow: hidden; //溢出内容隐藏
            text-overflow: ellipsis; //文本溢出部分用省略号表示
            display: -webkit-box; //特别显示模式
            -webkit-line-clamp: 3; //行数
            line-clamp: 3;
            -webkit-box-orient: vertical; //盒子中内容竖直排列
            width: 100%;
          }
          .type {
            position: relative;
            color: #a2a2a2;
            font-size: 12px;
            i {
              margin-left: 10px;
            }
            &::after {
              position: absolute;
              top: 50%;
              left: 52px;
              transform: translateY(-50%);
              width: 1px;
              height: 10px;
              content: "";
              background-color: #ececec;
            }
          }
        }
      }
    }
  }
}
</style>